package day14;

public class Cat extends Animal {
    private boolean isIndoor; // 是否为宠物猫
    
    public Cat() {
        super();
    }
    
    public Cat(String name, int age, boolean isIndoor) {
        super(name, age);
        this.isIndoor = isIndoor;
    }
    
    // 重写父类的方法
    @Override
    public void eat() {
        System.out.println(name + " 在干饭");
    }
    
    // 子类特有的方法
    public void meow() {
        System.out.println(name + " 在喵喵叫");
    }
    
    public void climb() {
        System.out.println(name + " 在爬树");
    }
    
    public boolean isIndoor() {
        return isIndoor;
    }
    
    public void setIndoor(boolean indoor) {
        isIndoor = indoor;
    }
    
    @Override
    public String toString() {
        return "猫的名字是" + name + ", 年龄是" + age + ", 是否为宠物猫：" + isIndoor + "";
    }
}